import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.PageSize;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfDocument;
import com.itextpdf.text.pdf.PdfWriter;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * Created by seko0313 on 14.01.14.
 */
public class pdfTest {

    public static void main(String args[]) {
        try {
            createPDF();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (DocumentException e) {
            e.printStackTrace();
        }
    }

    private static void createPDF() throws FileNotFoundException, DocumentException {
        Document document = new Document(PageSize.POSTCARD);

        PdfWriter.getInstance(document, new FileOutputStream("hello.pdf"));

        document.open();

        document.add(new Paragraph("Hello, World!"));

        document.close();
    }

}
